<template>
  <div id="Header" class="app">
    <div class="menudemo">
      <span class="rowRow">
        <a href="/">首页 </a>
      </span>
      <span v-if="this.user.loginname==null" class="rowRow">
        <a href="/login">登录</a>
      </span>
      <span v-if="this.user.loginname==null" class="rowRow">
        <a href="/register">免费注册</a>
      </span>
      <span v-if="this.user.loginname!=null" class="rowRow">
        <a href="/personCenter">欢迎你，{{this.user.loginname}}</a>
      </span>
      <span v-if="this.user.loginname!=null" class="rowRow">
        <a @click="doLogOut">注销</a>
      </span>
<!--      <span class="rowRow1"><a href="https://www.ele.me" target="_blank">我的订单</a></span>-->
      <span class="rowRow1"><a href="/cart" disabled="">购物车</a></span>
    </div>
  </div>
</template>

<script>
export default {
  name: "Header",
  data(){
    return{
      navigateData: ['login','首页', '登录', '购物车', '我的订单'],
      title: '网上书城',
      user: this.$store.getters.getUser
    }
  },
  methods:{
    doLogOut(){
      sessionStorage.clear();
      location.reload();
    }
  },
  created(){
      // alert();
      console.log(this.$store.getters.getUser)
  }
}
</script>

<style scoped>
.app {
  /*height: 50px;*/
  width: 100%;
  height: 32px;
  margin-top: 0px;
  margin-bottom: 0px;
  line-height: 1px;
  padding: 0;
}
.rowRow{
  float: left;
}
.rowRow1{
  float: right;
}

span{
  margin-right: 50px;
}

.menudemo {
  /*width: 800px;*/
  height: 30px;
  margin-top: 0px;
  text-align: center;
  padding: 20px;
  background-color: #f2f2f2;

}

a{
  /*font-*/
  color: #999;
}
/*.active{
  margin-left: 50px;
}*/
</style>
